
import 'package:flutter_taotaoshipin/http/request/sms_send_request.dart';
import 'package:flutter_taotaoshipin/model/base_entity.dart';
import 'package:flutter_taotaoshipin/model/sms_send_entity.dart';
import 'package:flutter_taotaoshipin/util/device_utils.dart';
import 'package:flutter_taotaoshipin/value/constant.dart';
import 'package:hi_net/hi_net.dart';

class SmsDao {
  /// 短信发送，Default: 0，类型：绑定手机0，登陆注册1，找回密码2
  static Future<BaseEntity<SmsSendEntity>> send({
    required String phone,
    int type = 0,
  }) async {
    var request = SmsSendRequest();
    request.add('phone', phone);
    request.add('from', Constant.from);
    request.add('ua', Device.userAgent());
    request.add('udid', Device.udid());
    request.add('oaid', Device.oaid());
    request.add('type', type);
    var result = await HiNet.getInstance().fire(request);
    return BaseEntity<SmsSendEntity>.fromJson(result);
  }
}
